<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
           margin: 0;
           padding: 0; 
           
        }
        /* 让容器的高度和宽度都充满全屏 */
        html,body{
            width: 100%;
            height: 100%;
        }
        body{
            background-color: pink;
            /* 开启弹性盒子 */
            display: flex;
            /* 元素排列方式 */
            flex-direction: row;
            align-items: center;     /*水平方向位置*/
            justify-content: center;   /*垂直方向位置*/
        }
        .heart{
            width: 200px;
            height: 200px;
            background-color: red;
            /* 相对定位 */
            position: relative;
            /* 让容器旋转45度 */
            transform: rotate(45deg);
        }
        /* 伪元素 */
        .heart::before{
            content: "";
            width: 200px;
            height: 100px;
            background-color: red;
            /* 绝对定位 */
            position: absolute;
            left: 0;
            top: -99px;
            border-radius: 100px 100px 0 0;
        }
        .heart::after{
            content: "";
            width: 100px;
            height: 200px;
            background-color: red;
            position: absolute;
            /* 避免伪元素和正方形之间出现间隔 */
            left: -99px;
            top: 0;
            border-radius: 100px 0 0 100px;
        }
    </style>
</head>
<body>
    <div class="heart"></div>
</body>
</html>